﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Workflow2211A.Application.DTO;
using Workflow2211A.Application.DTO.Inputs;
using Workflow2211A.Application.DTO.Outputs;
using Workflow2211A.Domain.Entities;

namespace Workflow2211A.Application.Services
{
    /// <summary>
    ///服务接口
    /// </summary>
    public interface IWorkflowService
    {
        /// <summary>
        /// 添加流程定义
        /// </summary>
        /// <returns></returns>
        APIResult<int> AddDefinition(DefinitionAddInput input);
        /// <summary>
        /// 将数据库中的流程定义加载至流程引擎中
        /// </summary>
        /// <param name="model">实体</param>
        void LoadDefinition(WorkflowDefinitionModel model);
        /// <summary>
        /// 流程发起
        /// </summary>
        /// <param name="input">输入参数</param>
        /// <returns></returns>
        Task<APIResult<string>> StartWorkflow(WorkflowStartInput input);
        /// <summary>
        /// 审批
        /// </summary>
        /// <param name="input">输入参数</param>
        /// <returns></returns>
        Task<APIResult<int>> Audit(AuditInput input);

        /// <summary>
        /// 添加代办
        /// </summary>
        /// <param name="audit"></param>
        /// <returns></returns>
        int AddAudit(AuditAddInput audit);

        /// <summary>
        /// 获取代办
        /// </summary>
        /// <returns></returns>
        APIPageing<AuditOutput> GetTodoList(PageInput pageInput);

        /// <summary>
        /// 获取流程设计列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        APIPageing<WorkflowDefinitionOutput> GetDefinitions(PageInput input);
        /// <summary>
        /// 查询流程实例
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        APIPageing<WorkflowInstanceOutput> GetWorkflows(WorkflowQueryInput input);

        /// <summary>
        /// 获取表单的详情
        /// </summary>
        /// <param name="workflowDefinitionId"></param>
        /// <returns></returns>
        APIResult<FormTemplateDetail> GetFormTemplateDetail(long workflowDefinitionId);
        /// <summary>
        /// 保存流程设计表单
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        APIResult<int> SaveFormTemplate(SaveFormTemplateInput input); 

        /// <summary>
        /// 获取流程详情
        /// </summary>
        /// <param name="workflowId">流程实例Id</param>
        /// <returns></returns>
        APIResult<WorkflowDetailOutput> GetWorkflowDetail(string workflowId);
    }
}
